import { _decorator, AudioSource, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('bgControl')
export class bgControl extends Component {

  bgMusic: boolean = true
  start() {

  }

  update(deltaTime: number) {

  }
  switchBgMusic() {
    this.bgMusic = !this.bgMusic
    const audio: AudioSource = this.getComponent(AudioSource)
    this.bgMusic ? audio.play() : audio.stop()
  }
}


